import Vue from 'vue'
import Vuex from 'vuex'
import App from './App.vue'
import axios from 'axios'
import router from './router/'
import store from './store/'
import './registerServiceWorker'
import vant from 'vant';
import { Lazyload } from 'vant';
import 'vant/lib/index.css';
import './assets/css/style.css';
Vue.prototype.axios = axios;
import cFooter from '@/components/Footer.vue'
Vue.component('c-footer',cFooter)
import goodItem from '@/components/goodItem.vue'
Vue.component('c-good-item',goodItem);
import G_header from '@/components/Header.vue'
Vue.component('G_header',G_header);
import copyright from './components/copyright.vue'
Vue.component('copyright',copyright);

import pay from '@/views/utils/pay'
Vue.prototype.pay = pay;
import share from '@/views/utils/share.js'
Vue.prototype.wxShare = share;

import is_404 from "../src/assets/img/404.png"

//  S vuex 全局变量
import Utils from '@/views/utils/utils'
Vue.prototype.Utils = Utils;
import global from '@/views/api/global.js'
Vue.prototype.global = global;
import indexData from '@/views/api/indexData.js'
Vue.prototype.indexData = indexData;
//  E vuex 全局变量


//  S vuex 全局函数
import Fns from '@/views/api/function.js'
Vue.prototype.Fns = Fns;
//  E vuex 全局函数


// 引入iconfont图标
import './assets/icon/iconfont.css';

require ('@/assets/icon/iconfont.js')




Vue.config.productionTip = false;

Vue.use(vant,Vuex)





Vue.filter('money',(v)=>{
  return `¥ ${v}`
})

Vue.filter('num',(v)=>{
  return `× ${v}`
})

Vue.filter('integral',(v)=>{
  return `积分 ${v}`
})

Vue.use(Lazyload, {
  preLoad: 1.3,
  error: is_404,
  // loading: 'static/img/loading.gif',
  attempt: 3
})

// 移动端 console
// import Vconsole from 'vconsole';
// const vConsole = new Vconsole();
// export default vConsole;
// 移动端 console

router.beforeEach((to, from, next) => {
  //会在任意路由跳转前执行，next一定要记着执行，不然路由不能跳转了
  next()
})



new Vue({
  router,
  store,
  global,
  render: h => h(App)
}).$mount('#app')
